package com.itcast.stargraph.utils;


import com.itcast.stargraph.pojo.User;

/**
 * 定义ThreadLocal对象，存储用户信息
 */
public class UserThreadLocalUtils {

    static ThreadLocal<User> userThreadLocal = new ThreadLocal<>();

    public static User getUser() {
        return userThreadLocal.get();
    }

    public static void setUser(User user) {
        userThreadLocal.set(user);
    }

    public static void removeUser() {
        userThreadLocal.remove();
    }

}